home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_12_04 / allison / scope2.c < prev   
Encoding:
C/C++ Source or Header  |  1994-02-10  |  478 b   |  42 lines

  1. LISTING 2 - Illustrates Function and File Scope
  2. /* scope2.c:    Illustrate function and file scope */
  3.  
  4. #include <stdio.h>
  5.  
  6. main()
  7. {
  8.     void f1(int);
  9.     void f2(void);
  10.  
  11.     f1(23);
  12.     f2();
  13.     return 0;
  14. }
  15.  
  16. int i = 13;
  17.  
  18. void f1(int i)
  19. {
  20.     for (;;)
  21.     {
  22.         float i = 33.0;
  23.  
  24.         printf("%f\n",i);
  25.         goto exit;
  26.     }
  27.  
  28. exit:
  29.     printf("%d\n",i);
  30. }
  31.  
  32. void f2(void)
  33. {
  34.     printf("%d\n",i);
  35. }
  36.  
  37. /* Output:
  38. 33.000000
  39. 23
  40. 13
  41. */
  42.